package com.ceshi.mvpdemo.Presenter;


import com.ceshi.mvpdemo.Model.MvpModel;
import com.ceshi.mvpdemo.View.MvpView;

public class MvpPresenter  extends BasePresenter<MvpView>{


    public void  getData(String params){
        getView().showLoading();

        MvpModel.getNetData(params, new MvpCallback<String>() {
            @Override
            public void onSuccess(String data) {
                if(isViewAttached()){
                    getView().showData(data);
                }
            }

            @Override
            public void onFailure(String msg) {
                if(isViewAttached()){
                    getView().showToast(msg);
                }

            }

            @Override
            public void onError() {
                if(isViewAttached()){
                    getView().showErr();
                }

            }

            @Override
            public void onComplete() {

                if(isViewAttached()){
                    getView().hideLoading();
                }
            }

            @Override
            public void ceshi() {

            }
        });
    }
}
